#include <stdio.h>
/* 1990年1月1日是星期一 */

//每个月的天数
int monthday[] ={0,31,28,31,30,31,30,31,31,30,31,30,31};

//判断闰年的函数，降低圈复杂度2
int judgeLeap(int year)
{
 if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
    {
       return 1;
    }
    else
    {
        return 0;
    }
}

int main()
{
    int year, month, day, week, leap;
    int sum = 0;
    int i;
//接收用户输入的日期
    scanf("%d/%d/%d", &year, &month, &day);
//查看中间间隔多少天
    for (i = 1990; i < year; i++)
    {
        if (judgeLeap(i))
        {
            sum += 366;
        }
        else
        {
            sum += 365;
        }
       
    }
    //判断闰年
    if (judgeLeap(year))
    {
      leap = 1;
    }
    else
    {
        leap = 0;
    }
   
      
   //计算到输入的月份之间的天数
   for(int i = 0;i < month;i++)
   {
        sum += monthday[i]; 
        if(i==2)
        {
            sum += leap;      //闰年加一天
        }
   }
   

    sum += day;
    week = sum % 7;
    
    if (week != 0)
    {
        printf("%d年%d月%d日是星期%d\n", year, month, day, week);
    }
    else
    {
        printf("%d年%d月%d日是星期日\n", year, month, day);
    }
    return 0;
}
